<?php

function hi(){
    return 'hi';
}

//验证Error信息转换
function getValidatorErrorStr($validator){
    $keys = $validator->errors()->keys();
    $ret = array();
    $ret['keys'] = $keys;
    $ret['error'] = implode(',', $validator->errors()->all());
    foreach ($keys as $key){
        $ret['errors'][$key] = $validator->errors()->get($key);
    }
    return array('validError'=>$ret);
}

//function zz(){
//    $plist = DB::select('select name, url from permissions where status = 1');
//    $str = '/admin/user/a1234/edit';
//    $xxx = "/admin/user/{*}/edit";
//    $xxx = str_replace("{*}", "[1-9a-zA-Z]*", $xxx);
//    $xxx = str_replace("/", "\/", $xxx);
//    $pattern = "/^(".$xxx.")$/";
//    if (preg_match($pattern, $str)) {
//        echo "验证成功";
//    } else {
//        echo "验证失敗";
//    }
//}